﻿<UserControl x:Class="nRoute.Samples.Netflix.Views.PersonView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
             xmlns:n="http://nRoute/schemas/2010/xaml"
             xmlns:local_Controls="clr-namespace:nRoute.Samples.Netflix.Controls" 
			 xmlns:local_Behaviors="clr-namespace:nRoute.Samples.Netflix.Behaviors"			 
             mc:Ignorable="d"
             d:DesignHeight="600" d:DesignWidth="800">
    
    <UserControl.Resources>
        <n:ValueConverterRelay x:Key="LimitListingConverter" />
		<n:ValueConverterRelay x:Key="ListingVisibilityConverter" />
        <n:ValueConverterRelay x:Key="ActedInTitlesQueryConverter" />
		<n:ValueConverterRelay x:Key="DirectedTitlesQueryConverter" />
		
        <Storyboard x:Key="OnLoaded1">
        	<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="LayoutRoot">
        		<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0">
        			<EasingDoubleKeyFrame.EasingFunction>
        				<CircleEase EasingMode="EaseOut"/>
        			</EasingDoubleKeyFrame.EasingFunction>
        		</EasingDoubleKeyFrame>
        	</DoubleAnimationUsingKeyFrames>
        	<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="stackPanel">
        		<EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="0">
        			<EasingDoubleKeyFrame.EasingFunction>
        				<CircleEase EasingMode="EaseOut"/>
        			</EasingDoubleKeyFrame.EasingFunction>
        		</EasingDoubleKeyFrame>
        	</DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>
	<UserControl.Triggers>
		<EventTrigger RoutedEvent="FrameworkElement.Loaded">
			<BeginStoryboard Storyboard="{StaticResource OnLoaded1}"/>
		</EventTrigger>
	</UserControl.Triggers>

    <i:Interaction.Behaviors>
        <n:BridgeViewModelBehavior/>
        <n:BridgeValueConverterBehavior ValueConverterRelay="{DynamicResource ActedInTitlesQueryConverter}" 
			ConverterSource="{Binding ActedInQueryConverter}"/>
        <n:BridgeValueConverterBehavior ValueConverterRelay="{DynamicResource DirectedTitlesQueryConverter}" 
			ConverterSource="{Binding DirectedInQueryConverter}"/>
    </i:Interaction.Behaviors>

	<Grid>
		
	    <ScrollViewer x:Name="LayoutRoot" Padding="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
			ScrollViewer.VerticalScrollBarVisibility="Auto" BorderThickness="0,0,1,0" Margin="0,0,60,55" 
			Style="{StaticResource BorderedScrollViewerStyle}" BorderBrush="#FF81868F" RenderTransformOrigin="0.5,0.5">
		
	    	<ScrollViewer.RenderTransform>
	    		<TransformGroup>
	    			<ScaleTransform/>
	    			<SkewTransform/>
	    			<RotateTransform/>
	    			<TranslateTransform X="50"/>
	    		</TransformGroup>
	    	</ScrollViewer.RenderTransform>
			
	        <Grid Margin="20,0,20,0">
	        	<Grid.RowDefinitions>
	        		<RowDefinition Height="Auto"/>
	        		<RowDefinition Height="Auto"/>
	        		<RowDefinition Height="Auto"/>
	        	</Grid.RowDefinitions>
				
	            <StackPanel x:Name="stackPanel" RenderTransformOrigin="0.5,0.5">
	            	<StackPanel.RenderTransform>
	            		<TransformGroup>
	            			<ScaleTransform/>
	            			<SkewTransform/>
	            			<RotateTransform/>
	            			<TranslateTransform X="50"/>
	            		</TransformGroup>
	            	</StackPanel.RenderTransform>
	        		<TextBlock FontFamily="Segoe UI Light" FontSize="42.667" TextWrapping="Wrap" 
	        			VerticalAlignment="Top" Margin="0,-8,0,0" Text="{Binding Person.Name}"/>
	        		<TextBlock TextWrapping="Wrap" Foreground="Black" HorizontalAlignment="Left" Cursor="Hand" 
	        			FontSize="13.333" FontFamily="Segoe UI Light" Margin="0,0,0,30" Text="Filmography Profile"/>
	        	</StackPanel>
				
	        	<StackPanel Orientation="Vertical" VerticalAlignment="Top" Grid.Row="1"
	            	Visibility="{Binding Person.TitlesActedIn, Converter={StaticResource ListingVisibilityConverter}}">
	               
	            	<TextBlock Text="Titles Acted In" Foreground="#FF3B3B3B" HorizontalAlignment="Left" 
	            		TextOptions.TextHintingMode="Animated" FontWeight="Bold" FontSize="12.667"/>
						
	            	<ItemsControl BorderThickness="0" Padding="0" 
	            		ItemsSource="{Binding Person.TitlesActedIn, Converter={StaticResource LimitListingConverter}}" 
	            		ItemTemplate="{StaticResource TitleItemTemplate}" ItemsPanel="{StaticResource TitlesPanelTemplate}" />
						
	            	<Grid Cursor="Hand" Background="Transparent" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,10">				
	            		<i:Interaction.Triggers>
	            			<i:EventTrigger EventName="MouseLeftButtonUp">							
	            				<n:NavigateAction HandlerName="ContentContainer" Url="Content/Netflix/Titles/" >
	            					<n:DependencyParameter Key="MovieQuery" Value="{Binding Person, Converter={StaticResource ActedInTitlesQueryConverter}}"/>
	            					<n:DependencyParameter Key="PageTitle" Value="{Binding Person.Name, StringFormat='Movies Acted In: {0}'}"/>
	            				</n:NavigateAction>
	            			</i:EventTrigger>
	            		</i:Interaction.Triggers>
	            		<TextBlock Margin="40,-3,8,0" TextWrapping="NoWrap" 
	            			FontSize="16" Foreground="#FF8D8D8D" TextTrimming="WordEllipsis" 
	            			FontFamily="Segoe UI Light" d:LayoutOverrides="Height" VerticalAlignment="Center" Text="Show More Results" HorizontalAlignment="Center"/>
	            		<Path Data="M2.0241784,19.292285 C5.3602659,25.493272 13.09179,27.815839 19.293021,24.479882 25.494251,21.143925 27.816909,13.412704 24.480821,7.2117164 21.144734,1.0107285 13.41321,-1.311838 7.2119791,2.0241188 1.0107486,5.3600755 -1.311909,13.091296 2.0241784,19.292285 z M13.357,6.6164999 L13.357,20.6165 M6.361,13.483998 L20.361,13.483998" 
	            			HorizontalAlignment="Center" Margin="-125,0,8,0" Stretch="Fill" Stroke="#FF8D8D8D" 
	            			UseLayoutRounding="False" Width="26.505" VerticalAlignment="Center" 
	            			Height="26.504" RenderTransformOrigin="0.484383694582177,0.508401081789119"/>				
	            	</Grid>
					
	            </StackPanel>
	        	
				<StackPanel Orientation="Vertical" VerticalAlignment="Top" Grid.Row="2"
	        		Visibility="{Binding Person.TitlesDirected, Converter={StaticResource ListingVisibilityConverter}}">
	               
	        		<TextBlock Text="Titles Directed" Foreground="#FF3B3B3B" HorizontalAlignment="Left" 
	        			TextOptions.TextHintingMode="Animated" FontWeight="Bold" FontSize="12.667"/>
						
	        		<ItemsControl BorderThickness="0" Padding="0" 
	        			ItemsSource="{Binding Person.TitlesDirected, Converter={StaticResource LimitListingConverter}}"							
	        			ItemTemplate="{StaticResource TitleItemTemplate}" ItemsPanel="{StaticResource TitlesPanelTemplate}"/>
											
	        		<Grid Cursor="Hand" Background="Transparent" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,10">				
	        			<i:Interaction.Triggers>
	        				<i:EventTrigger EventName="MouseLeftButtonUp">							
	        					<n:NavigateAction HandlerName="ContentContainer" Url="Content/Netflix/Titles/" >
	        						<n:DependencyParameter Key="MovieQuery" Value="{Binding Person, Converter={StaticResource DirectedTitlesQueryConverter}}"/>
	        						<n:DependencyParameter Key="PageTitle" Value="{Binding Person.Name, StringFormat='Movies Directed By: {0}'}"/>
	        					</n:NavigateAction>
	        				</i:EventTrigger>
	        			</i:Interaction.Triggers>
	        			<TextBlock Margin="40,-3,8,0" TextWrapping="NoWrap" 
	        				FontSize="16" Foreground="#FF8D8D8D" TextTrimming="WordEllipsis" 
	        				FontFamily="Segoe UI Light" d:LayoutOverrides="Height" VerticalAlignment="Center" Text="Show More Results" HorizontalAlignment="Center"/>
	        			<Path Data="M2.0241784,19.292285 C5.3602659,25.493272 13.09179,27.815839 19.293021,24.479882 25.494251,21.143925 27.816909,13.412704 24.480821,7.2117164 21.144734,1.0107285 13.41321,-1.311838 7.2119791,2.0241188 1.0107486,5.3600755 -1.311909,13.091296 2.0241784,19.292285 z M13.357,6.6164999 L13.357,20.6165 M6.361,13.483998 L20.361,13.483998" 
	        				HorizontalAlignment="Center" Margin="-125,0,8,0" Stretch="Fill" Stroke="#FF8D8D8D" 
	        				UseLayoutRounding="False" Width="26.505" VerticalAlignment="Center" 
	        				Height="26.504" RenderTransformOrigin="0.484383694582177,0.508401081789119"/>				
	        		</Grid>
					
	        	</StackPanel>

	        </Grid>
	    </ScrollViewer>
		
		<local_Controls:WorkingIndicator IsWorking="{Binding IsLoading}" Margin="0,0,0,0" d:IsHidden="True"/>
		
	</Grid>

</UserControl>

